module.exports = function($scope, $state, $stateParams, update, myinfo, place_code){

	$scope.objt = {};

	myinfo.get({'id' : $stateParams.id}, function(res){
		if(res.errcode === 0) {
			$scope.objt = res.data;
			$scope.objt.place_code = $scope.objt.place_code || '';
		} else {
			alert(res.errmsg);
		}
	});

	$scope.loadPlaceList = function(){
		place_code.save({}, function(res){
			if(res.errcode === 0) {
				$scope.place_list = res.data;
				$scope.place_list.unshift({'name': '系统公告', 'code': ''});
			} else {
				alert(res.errmsg);
			}
		});
	};
	$scope.loadPlaceList();

	$scope.gogo = function(){
		$scope.objt.id = $stateParams.id;
		update.save($scope.objt, function(res){
			if(res.errcode === 0) {
				$state.go('app.createnotice');
			} else {
				alert(res.errmsg);
			}
		});
	};
	
};